<!--
 * @Description: 订单统计
 * @Author: zzj
 * @Date: 2021-10-26 19:28:58
 * @LastEditors: zzj
 * @LastEditTime: 2021-10-29 10:05:14
-->
<template>
	<div class="statistics_order">
		<div ref="root"></div>
	</div>
</template>
<script>
import { Pie } from '@antv/g2plot';
import {get} from "@/utils/request"
export default {
	data(){
		return {

		}
	},
	mounted(){
		this.initChart();
	},
	methods:{
		async initChart(){
			let container = this.$refs.root;

			let url = "/statistics/orderStatus";
			let resp = await get(url);
			const data = [] ;
			// 数据清洗、转换
			for (let k in resp.data){
				let v = resp.data[k];
				let o = {type:k,value:v}
				data.push(o)
			}

			const dualAxes = new Pie(container, {
				data,
				angleField: 'value',
				colorField: 'type',
				radius: 1,
				innerRadius: 0.6,
			});

			dualAxes.render();
		}
	}
}
</script>
<style lang="scss" scoped>

</style>